document.onkeydown = function(e) {
	
 // 火狐中是 window.event 
	if (!e) {
		e = window.event; 
		} 
	if ((e.keyCode || e.which) == 13) {
		document.getElementById("btnUpdPwd").click();
		}
	  
};

// 页面加载
$(document).ready(function() {
	// 表单验证开始 
	$("#formValidate").validate({
		rules : {
			loginPwd : {
				required : true,	
				rangelength: [6, 14] ,
				noSpaceBar:true,
				remote : {
					url : basePath + "acct/safe/checkLoginPwd.shtml",
					type : "post",
					dataType : "json",
					data : {
						"loginPwd" : function() {
							return $("#loginPwd").val();
						}
					} 
				}
			},
			newLoginPwd : {
				required : true,
				rangelength: [6, 14],
				noSpaceBar:true,
				strongPsw:true,
				same:true
			} 
		},
		messages : {
			loginPwd : {
				required : '请输入当前登录密码', 
				rangelength :"密码必须为6-14位字符",
				remote:"登录密码不正确"
			} 
		} 
	});
});
 
function updateCustLoginPwd() {
	$.ajax({
		url : basePath + "acct/safe/updateCustLoginPwd.shtml",
		type : "post",
		data : $("#formValidate").serializeObject(),
		dataType : "json",
		success : function(result) {
			if (result.success) {
				document.location = basePath + "acct/safe/index.shtml";
			} else {
				handleAjaxResponseError(result);
			}
		},
		error : function(xhr) {
			handleAjaxRequestError(xhr);
		}
	});

}
  
